home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16663 < prev    next >
Encoding:
Text File  |  1996-08-05  |  928 b   |  50 lines

  1. Newsgroups: comp.lang.c++
  2. Path: dmocc2.on.bell.ca!bc2cep!news
  3. From: g2david@sprynet.com (David Leung)
  4. Subject: Array pointer?
  5. X-Nntp-Posting-Host: duncjm.on.bell.ca
  6. Message-ID: <DppIHL.MzF@on.bell.ca>
  7. Sender: news@on.bell.ca (news admin)
  8. Reply-To: g2david@sprynet.com (David Leung)
  9. Organization: Bell Canada, Bell Sygma, SRCI
  10. X-Newsreader: IBM NewsReader/2 v1.02
  11. Distribution: all
  12. Date: Thu, 11 Apr 1996 16:44:09 GMT
  13.  
  14.  
  15. if I write this
  16.  
  17.     int a[10];
  18.     int *b1=a;  <--- The pointer b points to the head of the array?
  19.     int b2=a    <--- What will we get?
  20.     int b3=*a   <--- what will we get?
  21.     int *b4=*a  <--- what will we get again?        
  22.  
  23.     ; access like a[3]
  24.     int *c1;
  25.  
  26.     c1= a+3
  27.     cout << *c1; ?
  28.     cout << c1;  ?
  29.     
  30.     ; is this correct?
  31.     int c2;
  32.     
  33.     c2 = *(a+3); ?
  34.     cout << c2;  ?
  35.     
  36.     ; is this correct, too?
  37.     int *c3
  38.     
  39.     c3 = (a + 3 * sizeof(int) );
  40.     count << *c3;
  41.  
  42.  
  43.  
  44. I am very confused!
  45.  
  46. Can anyone explain those to me, please!
  47.  
  48. g2david
  49. :->
  50.